<?php

include_once("./_common.php");
include_once ("./admin.head.php");
?>
<!-- <script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>-->
<?php
$w = $_GET['w'];
$id = $_GET['id'];
if($w == "u") {
	$sql = "select * from manage where id = '$id'";
	$rst = sql_query($sql);
	$write = mysql_fetch_assoc($rst);
	//print_r2($write);
} else {
	$w = "";
}

function name_change($list_id){
	alert("dfjkdsf");
	$sql = "select * from manage_list where id=$list_id";
	$rst = sql_query($sql);
	$mn_list = mysql_fetch_assoc($rst);
	
// 	$zip = explode('-', $mn_list['a_zip']);
	setZip($mn_list['a_zip']);
	setAddr($mn_list['a_addr']);
	
}

?>
<script type="text/javascript">
<!--

//-->
function setZip(zip){
	var a_zip = zip.split('-');
	document.getElementById('a_zip1').value = a_zip[0];
	document.getElementById('a_zip2').value = a_zip[1];
}
function setAddr(addr){
	var a_addr = addr.split('  ');
	document.getElementById('a_addr1').value = a_addr[0];
	document.getElementById('a_addr2').value = a_addr[1];
}
</script>
<style>
#csshelp1 { border:0px; background:#FFFFFF; padding:6px; }
#csshelp2 { border:2px solid #BDBEC6; padding:0px; }
#csshelp3 { background:#F9F9F9; padding:6px; width:200px; color:#222222; line-height:120%; text-align:center; }

div.input_wrap {width:700px;margin:0 auto; font-family:'맑은 고딕'}
table.input_table {margin-top:20px;width:688px;border:1px solid #d9d9d9; }
table.input_table tr {height:36px;}
table.input_table th {background-color:#f9f9f7;border-top:1px solid #d9d9d9;border-right:1px solid #d9d9d9;text-align:left;padding-left:8px;font-weight:normal}
table.input_table td {padding-left:10px;border-top:1px solid #d9d9d9;}
div.input_btn {width:698px;text-align:center;margin-top:20px}

.input_txt {border:1px solid #abadb3}
th.col3_line {border-left:1px solid #d9d9d9}
</style>
<script src="http://openapi.map.naver.com/openapi/naverMap.naver?ver=2.0&key=77de4ca6328d2a037e70b1ced140c127"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js" type="text/javascript"></script>
<script>
$(function() {
	$( "#datepicker" ).datepicker({
	  showOn: "button",
	  buttonImage: "/test/manage/imgs/cal_btn.gif",
	  buttonImageOnly: true,
	  showAnim: "slideDown",
	  dateFormat: "yy-mm-dd",
	  changeMonth: true,
	  changeYear: true,
	  monthNames: true
	});
});
$(function() {
	$("#a_openday").datepicker({
	  showOn: "button",
	  buttonImage: "/test/manage/imgs/cal_btn.gif",
	  buttonImageOnly: true,
	  showAnim: "slideDown",
	  dateFormat: "yy-mm-dd",
	  changeMonth: true,
	  changeYear: true,
	  monthNames: true
	});
});
</script>

<div class="input_wrap">
	<br />
	<img src="./img_btn/manage_tit.jpg" style="display:block;width:185px;margin:0 auto;text-align:center"/>
	<form action="./manage_update.php" method="post" id="fregister" name="fregister" enctype="multipart/form-data">
		<input type="hidden" name="w" value="<?php echo $w;?>" />
		<input type="hidden" name="id" value="<?php echo $id;?>" />
		<table class="input_table" cellpadding="0" cellspacing="0" border="0">
		<colgroup>
		<col width="118px" />
		<col width="" />
		<col width="118px" />
		<col width="" />
		</colgroup>
		<tr>
		<th style="border-top:none;">지역선택 <?php echo help2("가맹점의 지역을 선택합니다.");?></th>
		<td colspan="3" style="border-top:none;">
			<select name="a_area" class="a_area input_txt">
			<option value="">지역선택</option>
			<?php
			$sqla = "select * from area_list order by area ASC";
			$rsta = sql_query($sqla);
			$list_mn = array();
			while($rowa = mysql_fetch_assoc($rsta)) {
				$list_mn[] = $rowa;
			}
			for($i = 0; $i < count($list_mn); $i += 1) {
			?>
			<option value="<?=$list_mn[$i]['area']?>" <?php echo $write['a_area'] == $list_mn[$i]['area'] ? "selected" : "";?>><?php echo $list_mn[$i]['area']?></option>
			<? } ?>
			</select>
			
		</td>
		</tr>
		<tr>
		<th>가맹점주소 <?php echo help2("가맹점의 주소를 입력합니다.");?></th>
		<td colspan="3">
			<p>
			<input type="text" id="a_zip1" name="a_zip1" size="5" maxlength="3" class="a_zip1 input_txt" title="우편번호 앞자리" value="<?php echo $sel_list[mn_zip]?>" />
			-
			<input type="text" id="a_zip2" name="a_zip2" size="5" maxlength="3" class="a_zip2 input_txt" title="우편번호 뒷자리" value="<?php echo $write['a_zip2']?>" />

			<a href="#" class="win_zip_find" onclick="return false;"><img src="./img_btn/zip_btn.gif" class="zip_imgj" style="vertical-align:bottom" alt="우편번호검색" /></a>
			</p>
<script>
$(".zip_imgj").click(function() {
	window.open("http://augustin.co.kr/adm/adm_new/zip.php?frm_name=fregister&amp;frm_zip1=a_zip1&amp;frm_zip2=a_zip2&amp;frm_addr1=a_addr1&amp;frm_addr2=a_addr2","주소찾기","width=600px,height=500px,menubar=no,toolbar=no,location=no,scrollbars=yes,status=no")
});
</script>
			<p class="guide"><input type="text" id="a_addr1" name="a_addr1" size="60" class="a_addr1 input_txt" title="주소" value="<?php echo $write['a_addr1']?>" /></p>

			<p class="guide">
				<input type="text" id="a_addr2" name="a_addr2" size="60" class="a_addr2 input_txt" title="상세주소" value="<?php echo $write['a_addr2']?>" />
				&nbsp;&nbsp;&nbsp;&nbsp;
				<img src="./img_btn/map_btn.gif" class="map_search" style="vertical-align:bottom;cursor:pointer" />
			</p>
		</td>
		</tr>
		<tr class="map_area" style="background-color:#eee">
		<td colspan="4" class="map_rst">
			<input type="hidden" name="s_map_x" class="s_map_x" value="<?php echo $write['s_map_x']?>" />
			<input type="hidden" name="s_map_y" class="s_map_y" value="<?php echo $write['s_map_y']?>" />
			<input type="hidden" name="s_zoom_level" class="s_zoom_level" value="<?php echo $write['s_zoom_level']?>" />
			<input type="hidden" name="s_point_x" class="s_point_x" value="<?php echo $write['s_point_x']?>" />
			<input type="hidden" name="s_point_y" class="s_point_y" value="<?php echo $write['s_point_y']?>" />
			<div id="map" style="border:1px solid #000;width:698px;height:500px"></div>
		</td>
		</tr>
		<script type="text/javascript">
			var map_show = 0;
			$(".map_search").click(function() {
			//function mapSearch(){
				var zip1 = $(".a_zip1").val();
				var zip2 = $(".a_zip2").val();
				var addr1 = $(".a_addr1").val();
				var addr2 = $(".a_addr2").val();
				
				if(addr1 == "") {
					alert("우편번호 검색을 클릭하여 주소를 입력하세요");
				} else if (addr2 == "") {
					alert("상세주소를 입력하세요");
				} else {
					$.ajax({
						type: "POST",
						url: "./ajax_map.php",
						data: {
							a: addr1,
							b: addr2
						},
						success: function(data) {
							if(map_show==0)
								$(".map_area").show();
							map_show = 1;
							
							var x = $(data).find("x").eq(0).text();
							var y = $(data).find("y").eq(0).text();
							
							$(".s_map_x").val(x);
							$(".s_map_y").val(y);
							var oPoint = new nhn.api.map.LatLng(y, x);
							nhn.api.map.setDefaultPoint('LatLng');
							oMap = new nhn.api.map.Map('map' ,{
									point : oPoint,
									zoom : 12,
									enableWheelZoom : true,
									enableDragPan : true,
									enableDblClickZoom : false,
									mapMode : 0,
									activateTrafficMap : false,
									activateBicycleMap : false,
									minMaxLevel : [ 1, 14 ],
									size : new nhn.api.map.Size(700, 500)
							});
							$(".s_zoom_level").val(oMap._oMap.getZoomLevel());
							var markerCount = 0;
	
							var oSize = new nhn.api.map.Size(28, 37);
							var oOffset = new nhn.api.map.Size(14, 37);
							var oIcon = new nhn.api.map.Icon('http://static.naver.com/maps2/icons/pin_spot2.png', oSize, oOffset);
	
							var mapInfoTestWindow = new nhn.api.map.InfoWindow();
							mapInfoTestWindow.setVisible(true);
							oMap.addOverlay(mapInfoTestWindow);
	
							var oLabel = new nhn.api.map.MarkerLabel();
							oMap.addOverlay(oLabel);
	
							mapInfoTestWindow.attach('changeVisible', function(oCustomEvent) {
								if (oCustomEvent.visible) {
										oLabel.setVisible(true);
								}
							});
	
							oMap.attach('click', function(oCustomEvent) {
								if(markerCount == 0) {
									var oPoint = oCustomEvent.point;
									var oTarget = oCustomEvent.target;
									mapInfoTestWindow.setVisible(true);
									var oMarker = new nhn.api.map.Marker(oIcon, { title : '마커 : ' });
									oMarker.setPoint(oPoint);
									oMap.addOverlay(oMarker);
									$(".s_point_x").val(oPoint.x);
									$(".s_point_y").val(oPoint.y);
									markerCount += 1;
								}
							});
							oMap.attach('mousewheel', function(oCustomEvent) {
								$(".s_zoom_level").val(oMap._oMap.getZoomLevel());
							});
							
						},
						dataType: "xml"
						
					});
				}
			});
			//}
		//});
		</script>
		<tr>
		<th>최초계약일 <?php echo help2("가맹점의 최초 계약일을 선택합니다.");?></th>
		<td>
			<input type="text" name="a_firstday" size="10" maxlength="8" class=" a_firstday input_txt" style="margin-right:5px" value="<?php echo $write['a_firstday']?>" id="datepicker" readonly>
		</td>
		<th class="col3_line">가맹점 계약기간 <?php echo help2("가맹점의 계약기간을 선택합니다.");?></th>
		<td>
			<?php if($w == "") { ?>
				<input type="radio" name="a_years" value="1" class="a_years " />1년
				<input type="radio" name="a_years" value="2" class="a_years " />2년
				<input type="radio" name="a_years" value="3" class="a_years " />3년
				<input type="radio" name="a_years" value="4" class="a_years " />4년
			<? } else if ($w == "u") { ?>
				<input type="radio" name="a_years" value="1" <?php echo $write['a_years'] == "1" ? "checked" : ""?> />1년
				<input type="radio" name="a_years" value="2" <?php echo $write['a_years'] == "2" ? "checked" : ""?> />2년
				<input type="radio" name="a_years" value="3" <?php echo $write['a_years'] == "3" ? "checked" : ""?> />3년
				<input type="radio" name="a_years" value="4" <?php echo $write['a_years'] == "4" ? "checked" : ""?> />4년
			<? } ?>
		</td>
		</tr>
		<tr>
		<th>갱신계약일 <?php echo help2("가맹점의 갱신계약일을 입력합니다.");?></th>
		<td colspan="3">
			<div class="day_select">
				<input type="radio" name="dst" class="ds_1" value="1" /> 있음
				<input type="radio" name="dst" class="ds_2" value="2" /> 없음
			</div>
			<div class="day_insert">
				첫번째갱신일 : <input type="text" name="a_day1" class="input_txt" value="<?php echo $write['a_day1']?>" />&nbsp;&nbsp;&nbsp;
				두번째갱신일 : <input type="text" name="a_day2" class="input_txt" value="<?php echo $write['a_day2']?>" /> <br />
				세번째갱신일 : <input type="text" name="a_day3" class="input_txt" value="<?php echo $write['a_day3']?>" />&nbsp;&nbsp;&nbsp;
				네번째갱신일 : <input type="text" name="a_day4" class="input_txt" value="<?php echo $write['a_day4']?>" /> <br />
			</div>
		</td>
		</tr>
		<script>
		$(".ds_1").click(function() {
			$(".day_insert").show();
		});
		$(".ds_2").click(function() {
			$(".day_insert").hide();
		});
		</script>
		<tr>
		<th>개설일(오픈일) <?php echo help2("가맹점의 개설일을 입력합니다.");?></th>
		<td colspan="3"><input type="text" name="a_openday" id="a_openday" size="10" maxlength="8" value="<?php echo $write['a_openday']?>" class="input_txt" readonly style="margin-right:5px;" /></td>
		</tr>
		<tr>
		<th>가맹점명 <?php echo help2("가맹점명을 입력합니다.");?></th>
		<td colspan="3">
		<select name="a_name1" class="a_name1">
			<option value="">가맹점선택</option>
			<?php 
				$sqla = "select * from manage_list order by mn_id ASC";
				$rsta = sql_query($sqla);
				$lista = array();
				while($rowa = mysql_fetch_assoc($rsta)) {
					$lista[] = $rowa;
				}
				
				for($i = 0; $i < count($lista); $i += 1) {
					if($write['a_name1'] == $lista[$i]['mn_name']){
						$opt_mn = "selected";
					
					}else{
						$opt_mn = "";
					}
				?>
				
				<option value="<?=$lista[$i]['mn_id']."/".$lista[$i]['mn_name']?>" <?=$opt_mn ?>><?php echo $lista[$i]['mn_name']?></option>
				
				<?
				} ?>
		</select>
		
		<script type="text/javascript">
// 			$(document).ready(function() {
				
				$(".a_name1").change(function(){
					var addr1 ="";
					var addr2 = "";
					var zip1 = "";
					var zip2 = "";
					$.ajax({
						type: "POST",
						url: "./ajax_list.php",
						dataType:'json',
						data: {
							a: $(this).val()
							
						},
				        success: function(data) {
					        alert(data['addr1']);
				        	addr1 = data.addr1;
				        	addr2 = data.addr2;
				        	zip1 = data.zip1;
				        	zip2 = data.zip2;
				        }
					});
					document.getElementById('a_zip1').value = zip1;
					document.getElementById('a_zip2').value = zip2;
					
				});
// 			});
			
		</script>
	
		<!-- <input type="text" name="a_name1" value="<?php echo $write['a_name1']?>" class="input_txt" />-->
		</td>
		</tr>
		<tr>
		<th>점주명 <?php echo help2("가맹점의 점주명을 입력합니다.");?></th>
		<td><input type="text" name="a_name2" value="<?php echo $write['a_name2']?>" class="input_txt" /></td>
		<th class="col3_line">점주이메일 <?php echo help2("가맹점 점주의 이메일을 입력합니다.");?></th>
		<td><input type="text" name="a_email" value="<?php echo $write['a_email']?>" class="input_txt" /></td>
		</tr>
		<tr>
		<th>사업자번호 <?php echo help2("가맹점의 사업자 번호를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_num1" value="<?php echo $write['a_num1']?>" class="input_txt" /> -
			<input type="text" name="a_num2" value="<?php echo $write['a_num2']?>" class="input_txt" /> -
			<input type="text" name="a_num3" value="<?php echo $write['a_num3']?>" class="input_txt" />
		</td>
		</tr>
		<tr>
		<th>매장전화 <?php echo help2("가맹점의 매장 전화번호를 입력합니다.");?></th>
		<td><input type="text" name="a_tel" value="<?php echo $write['a_tel']?>" class="input_txt" /></td>
		<th class="col3_line">핸드폰번호 <?php echo help2("연락가능한 핸드폰번호를 입력합니다.");?></th>
		<td><input type="text" name="a_hp" value="<?php echo $write['a_hp']?>" class="input_txt" /></td>
		</tr>
		<tr>
		<th>월별매출 <?php echo help2("월별 매출을 입력합니다.");?><br />
			<span style="cursor:pointer" class="bt_plus"><img src="./img_btn/plus_btn.gif" /></span>
			<span style="cursor:pointer" class="bt_minu"><img src="./img_btn/minu_btn.gif" /></span>
		</th>
		<td colspan="3">
			<span class="vm1s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 1월
				<input type="text" class="vm1 vm" width="90%" name="vi_month1" tabindex=5 value="<?php echo $write['vi_month1']?>" /> <br />
			</span>
			<div class="vm2d"></div><div class="vm3d"></div><div class="vm4d"></div><div class="vm5d"></div><div class="vm6d"></div><div class="vm7d"></div><div class="vm8d"></div><div class="vm9d"></div><div class="vm10d"></div><div class="vm11d"></div><div class="vm12d"></div>
			<span class="vm2s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 2월
				<input type="text" class="vm2 vm" width="90%" name="vi_month2" tabindex=6 value="<?php echo $write['vi_month2']?>" /> <br />
			</span>
			<span class="vm3s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 3월
				<input type="text" class="vm3 vm" width="90%" name="vi_month3" tabindex=7 value="<?php echo $write['vi_month3']?>" /> <br />
			</span>
			<span class="vm4s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 4월
				<input type="text" class="vm4 vm" width="90%" name="vi_month4" tabindex=8 value="<?php echo $write['vi_month4']?>" /> <br />
			</span>
			<span class="vm5s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 5월
				<input type="text" class="vm5 vm" width="90%" name="vi_month5" tabindex=9 value="<?php echo $write['vi_month5']?>" /> <br />
			</span>
			<span class="vm6s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 6월
				<input type="text" class="vm6 vm" width="90%" name="vi_month6" tabindex=10 value="<?php echo $write['vi_month6']?>" /> <br />
			</span>
			<span class="vm7s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 7월
				<input type="text" class="vm7 vm" width="90%" name="vi_month7" tabindex=11 value="<?php echo $write['vi_month7']?>" /> <br />
			</span>
			<span class="vm8s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 8월
				<input type="text" class="vm8 vm" width="90%" name="vi_month8" tabindex=12 value="<?php echo $write['vi_month8']?>" /> <br />
			</span>
			<span class="vm9s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 9월
				<input type="text" class="vm9 vm" width="90%" name="vi_month9" tabindex=13 value="<?php echo $write['vi_month9']?>" /> <br />
			</span>
			<span class="vm10s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 10월
				<input type="text" class="vm10 vm" width="90%" name="vi_month10" tabindex=14 value="<?php echo $write['vi_month10']?>" /> <br />
			</span>
			<span class="vm11s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 11월
				<input type="text" class="vm11 vm" width="90%" name="vi_month11" tabindex=15 value="<?php echo $write['vi_month11']?>" /> <br />
			</span>
			<span class="vm12s">
				<?php echo substr(date("Y-m-d"),0,4);?>년 12월
				<input type="text" class="vm12 vm" width="90%" name="vi_month12" tabindex=16 value="<?php echo $write['vi_month12']?>" />
			</span>
		</td>
		</tr>
		<script>
		window.onload = function() {
			var vm2s = $(".vm2s").detach();var vm3s = $(".vm3s").detach();var vm4s = $(".vm4s").detach();var vm5s = $(".vm5s").detach();var vm6s = $(".vm6s").detach();var vm7s = $(".vm7s").detach();var vm8s = $(".vm8s").detach();var vm9s = $(".vm9s").detach();var vm10s = $(".vm10s").detach();var vm11s = $(".vm11s").detach();var vm12s = $(".vm12s").detach();
			$(".bt_plus").click(function() {
				var vmp = $(".vm").length;
				if(vmp == "1") {
					$(".vm2d").html(vm2s);
				} else if (vmp == "2") {
					$(".vm3d").html(vm3s);
				} else if (vmp == "3") {
					$(".vm4d").html(vm4s);
				} else if (vmp == "4") {
					$(".vm5d").html(vm5s);
				} else if (vmp == "5") {
					$(".vm6d").html(vm6s);
				} else if (vmp == "6") {
					$(".vm7d").html(vm7s);
				} else if (vmp == "7") {
					$(".vm8d").html(vm8s);
				} else if (vmp == "8") {
					$(".vm9d").html(vm9s);
				} else if (vmp == "9") {
					$(".vm10d").html(vm10s);
				} else if (vmp == "10") {
					$(".vm11d").html(vm11s);
				} else if (vmp == "11") {
					$(".vm12d").html(vm12s);
				} else if (vmp == "12") {
					alert("더이상 추가할 수 없습니다.");
				}
			});
			$(".bt_minu").click(function() {
				var vmm = $(".vm").length;
				if(vmm == "1") {
					alert("더이상 삭제할 수 없습니다.");
				} else if (vmm == "2") {
					$(".vm2d").detach();
				} else if (vmm == "3") {
					$(".vm3d").detach();
				} else if (vmm == "4") {
					$(".vm4d").detach();
				} else if (vmm == "5") {
					$(".vm5d").detach();
				} else if (vmm == "6") {
					$(".vm6d").detach();
				} else if (vmm == "7") {
					$(".vm7d").detach();
				} else if (vmm == "8") {
					$(".vm8d").detach();
				} else if (vmm == "9") {
					$(".vm9d").detach();
				} else if (vmm == "10") {
					$(".vm10d").detach();
				} else if (vmm == "11") {
					$(".vm11d").detach();
				} else if (vmm == "12") {
					$(".vm12d").detach();
				}
			});
		}
		</script>
		<tr>
		<th>계약만료일 <?php echo help2("가맹점의 계약만료일을 입력합니다.");?></th>
		<td colspan="3"><input type="text" name="a_endday" value="<?php echo $write['a_endday']?>" style="background-color:#eee" class="input_txt endday" /></td>
		</tr>
		<tr>
		<th>100일전통보일 <?php echo help2("가맹점의 계약만료일의 100일전을 알려줍니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_notiday" value="<?php echo $write['a_notiday']?>" style="background-color:#eee" class="input_txt notiday" />
			&nbsp;&nbsp;
			알림방식 :
			<?php if($w == "") { ?>
				<input type="radio" name="a_noti" value="1" class="a_noti" checked />팝업
				&nbsp;
				<input type="radio" name="a_noti" value="2" class="a_noti" />글색변경
				&nbsp;
				<input type="radio" name="a_noti" value="3" class="a_noti" />배경색
			<? }  else if ($w == "u") { ?>
				<input type="radio" name="a_noti" value="1" <?php echo $write['a_noti'] == "1" ? "checked" : ""?> class="a_noti" />팝업
				&nbsp;
				<input type="radio" name="a_noti" value="2" <?php echo $write['a_noti'] == "2" ? "checked" : ""?> class="a_noti" />글색변경
				&nbsp;
				<input type="radio" name="a_noti" value="3" <?php echo $write['a_noti'] == "3" ? "checked" : ""?> class="a_noti" />배경색
			<? } ?>
		</td>
		</tr>
		<tr>
		<th>양도양수여부 <?php echo help2("가맹점의 양도양수여부를 선택합니다.");?></th>
		<td colspan="3">
			<?php if($w == "") { ?>
				<input type="radio" name="a_transfer" value="1" checked /> 여
				&nbsp;&nbsp;&nbsp;
				<input type="radio" name="a_transfer" value="2" /> 부
			<? } else if ($w == "u") { ?>
				<input type="radio" name="a_transfer" value="1" <?php echo $write['a_transfer'] == "1" ? "checked" : ""?> /> 여
				&nbsp;&nbsp;&nbsp;
				<input type="radio" name="a_transfer" value="2" <?php echo $write['a_transfer'] == "2" ? "checked" : ""?> /> 부
			<? } ?>
		</td>
		</tr>
		</table>

		<table cellpadding="0" cellspacing="0" border="0" style="width:688px">
		<tr style="height:41px">
		<td colspan="4" style="border-bottom:1px dashed #d9d9d9"></td>
		</tr>
		<tr style="height:20px">
		<td colspan="4"></td>
		</tr>
		<tr>
		<td colspan="4" style="background:url(/test/manage/imgs/tit_bg.gif) repeat-x;height:38px;color:white;padding-left:10px;font-weight:bold;">기타지출내역</td>
		</tr>
		</table>

		<table class="input_table" cellpadding="0" cellspacing="0" border="0">
		<colgroup>
		<col width="118px" />
		<col width="" />
		<col width="118px" />
		<col width="" />
		</colgroup>
		<tr>
		<th style="border-top:none">가맹비 <?php echo help2("가맹비를 입력합니다.");?></th>
		<td colspan="3" style="border-top:none"><input type="text" name="a_g_cost" class="input_txt" value="<?php echo $write['a_g_cost']?>" />원</td>
		</tr>
		<tr>
		<th>교육비 <?php echo help2("교육비를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_edu_cost" class="input_txt" value="<?php echo $write['a_edu_cost']?>" />원<br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_edu_detail" class="input_txt" value="<?php echo $write['a_edu_detail']?>" />
		</td>
		<tr>
		<th>교육인원 <?php echo help2("교육인원을 입력합니다.");?></th>
		<td><input type="text" name="a_edu_num" class="input_txt" value="<?php echo $write['a_edu_num']?>" />명</td>
		<th class="col3_line">교육이수 시간 <?php echo help2("교육이수시간을 입력합니다.");?></th>
		<td><input type="text" name="a_edu_time" class="input_txt" value="<?php echo $write['a_edu_time']?>" />시간</td>
		</tr>
		<tr>
		<th>이행보증금 <?php echo help2("이행보증금을 입력합니다.");?></th>
		<td colspan="3"><input type="text" name="a_b_cost" class="input_txt" value="<?php echo $write['a_b_cost']?>" />원</td>
		</tr>
		<tr>
		<th>홍보비 <?php echo help2("홍보비를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_h_cost" class="input_txt" value="<?php echo $write['a_h_cost']?>" />원<br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_h_detail" class="input_txt" value="<?php echo $write['a_h_detail']?>" />
		</td>
		</tr>
		<tr>
		<th>인테리어 <?php echo help2("인테리어를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_i_cost" class="input_txt" value="<?php echo $write['a_i_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_i_r" value="1" checked />여
				<input type="radio" name="a_i_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_i_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_i_r" value="1" <?php echo $write['a_i_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_i_r" value="2" <?php echo $write['a_i_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_i_r" value="3" <?php echo $write['a_i_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_i_name" class="input_txt" value="<?php echo $write['a_i_name']?>" />
			연락처<input type="text" name="a_i_tel" class="input_txt" value="<?php echo $write['a_i_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_i_detail" class="input_txt" value="<?php echo $write['a_i_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>간판 <?php echo help2("간판을 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_p_cost" class="input_txt" value="<?php echo $write['a_p_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_p_r" value="1" checked />여
				<input type="radio" name="a_p_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_p_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_p_r" value="1" <?php echo $write['a_p_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_p_r" value="2" <?php echo $write['a_p_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_p_r" value="3" <?php echo $write['a_p_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_p_name" class="input_txt" value="<?php echo $write['a_p_name']?>" />
			연락처<input type="text" name="a_p_tel" class="input_txt" value="<?php echo $write['a_p_tel']?>" /> <br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_p_detail" class="input_txt" value="<?php echo $write['a_p_detail']?>" /> <br />

		</td>
		</tr>
		<tr>
		<th>주방집기 <?php echo help2("주방집기를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_j_cost" class="input_txt" value="<?php echo $write['a_j_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_j_r" value="1" checked />여
				<input type="radio" name="a_j_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_j_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_j_r" value="1" <?php echo $write['a_j_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_j_r" value="2" <?php echo $write['a_j_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_j_r" value="3" <?php echo $write['a_j_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_j_name" class="input_txt" value="<?php echo $write['a_j_name']?>" />
			연락처<input type="text" name="a_j_tel" class="input_txt" value="<?php echo $write['a_j_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_j_detail" class="input_txt" value="<?php echo $write['a_j_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>홀설비 <?php echo help2("홀설비를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_s_cost" class="input_txt" value="<?php echo $write['a_s_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_s_r" value="1" checked />여
				<input type="radio" name="a_s_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_s_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_s_r" value="1" <?php echo $write['a_s_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_s_r" value="2" <?php echo $write['a_s_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_s_r" value="3" <?php echo $write['a_s_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_s_name" class="input_txt" value="<?php echo $write['a_s_name']?>" />
			연락처<input type="text" name="a_s_tel" class="input_txt" value="<?php echo $write['a_s_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_s_detail" class="input_txt" value="<?php echo $write['a_s_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>초도물품 <?php echo help2("초도물품을 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_m_cost" class="input_txt" value="<?php echo $write['a_m_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_m_r" value="1" checked />여
				<input type="radio" name="a_m_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_m_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_m_r" value="1" <?php echo $write['a_m_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_m_r" value="2" <?php echo $write['a_m_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_m_r" value="3" <?php echo $write['a_m_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_m_name" class="input_txt" value="<?php echo $write['a_m_name']?>" />
			연락처<input type="text" name="a_m_tel" class="input_txt" value="<?php echo $write['a_m_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_m_detail" class="input_txt" value="<?php echo $write['a_m_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>초도식자재 <?php echo help2("초도식자재를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_c_cost" class="input_txt" value="<?php echo $write['a_c_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_c_r" value="1" checked />여
				<input type="radio" name="a_c_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_c_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_c_r" value="1" <?php echo $write['a_c_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_c_r" value="2" <?php echo $write['a_c_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_c_r" value="3" <?php echo $write['a_c_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_c_name" class="input_txt" value="<?php echo $write['a_c_name']?>" />
			연락처<input type="text" name="a_c_tel" class="input_txt" value="<?php echo $write['a_c_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_c_detail" class="input_txt" value="<?php echo $write['a_c_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>포스 <?php echo help2("포스를 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_f_cost" class="input_txt" value="<?php echo $write['a_f_cost']?>" />원
			&nbsp;&nbsp;&nbsp;
			<?php if($w == "") { ?>
				가맹점주직접진행
				<input type="radio" name="a_f_r" value="1" checked />여
				<input type="radio" name="a_f_r" value="2" />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_f_r" value="3" />
				본사진행
			<? } else if ($w == "u") { ?>
				가맹점주직접진행
				<input type="radio" name="a_f_r" value="1" <?php echo $write['a_f_r'] == "1" ? "checked" : ""?> />여
				<input type="radio" name="a_f_r" value="2" <?php echo $write['a_f_r'] == "2" ? "checked" : ""?> />부
				&nbsp;or&nbsp;
				<input type="radio" name="a_f_r" value="3" <?php echo $write['a_f_r'] == "3" ? "checked" : ""?> />
				본사진행
			<? } ?><br />
			업체명<input type="text" name="a_f_name" class="input_txt" value="<?php echo $write['a_f_name']?>" />
			연락처<input type="text" name="a_f_tel" class="input_txt" value="<?php echo $write['a_f_tel']?>" /><br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_f_detail" class="input_txt" value="<?php echo $write['a_f_detail']?>" /><br />

		</td>
		</tr>
		<tr>
		<th>기타비용 <?php echo help2("기타비용을 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_etc_cost" class="input_txt" value="<?php echo $write['a_etc_cost']?>" />원<br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_etc_detail" class="input_txt" value="<?php echo $write['a_etc_detail']?>" />
		</td>
		</tr>
		<tr>
		<th>본사지원금액 <?php echo help2("본사지원금액을 입력합니다.");?></th>
		<td colspan="3">
			<input type="text" name="a_supp_cost" class="input_txt" value="<?php echo $write['a_supp_cost']?>" />원<br />
			세부지출내역<br />
			<input type="text" size="90%" name="a_supp_detail" class="input_txt" value="<?php echo $write['a_supp_detail']?>" />
		</td>
		</tr>
		</table>

		<table cellpadding="0" cellspacing="0" border="0" style="width:688px">
		<tr style="height:41px">
		<td colspan="4" style="border-bottom:1px dashed #d9d9d9"></td>
		</tr>
		</table>

		<table class="input_table" cellpadding="0" cellspacing="0" border="0">
		<colgroup>
		<col width="118px" />
		<col width="" />
		<col width="118px" />
		<col width="" />
		</colgroup>
		<style>
		.m_plus {cursor:pointer}
		.m_minu {cursor:pointer}
		</style>
		<tr>
		<th style="border-top:none">
			문서파일첨부 <?php echo help2("문서형식으로 첨부한 파일입니다.<br /><span style='color:red'>파일명을 꼭 영어로 해주세요.</span>");?>
			<br />
			<?php if($w != "u") { ?>
				<span class="m_plus"><img src="<?php echo $g4['path']?>/test/manage/imgs/plus_btn.gif" /></span>
				<span class="m_minu"><img src="<?php echo $g4['path']?>/test/manage/imgs/minu_btn.gif" /></span>
			<? } ?>
		</th>
		<td colspan="3" style="border-top:none">
			<?php
			$m0 = $write['m_file0'];
			$m1 = $write['m_file1'];
			$m2 = $write['m_file2'];

			$mf0 = str_replace("./file/manage/", "", $m0);
			$mf1 = str_replace("./file/manage/", "", $m1);
			$mf2 = str_replace("./file/manage/", "", $m2);
			?>
			<div class="m_file0">
			<input type="file" name="m_file0" class="m_file" value="<?php echo $mf0?>" /> <?php echo $mf0?>
			<?php if($mf0) { ?>
			<input type="checkbox" name="del_m0" value="1" />삭제
			<? } ?>
			</div>
			<div class="mf_d1"></div><div class="mf_d2"></div>
			<div class="m_file1">
			<input type="file" name="m_file1" class="m_file" value="<?php echo $mf1?>" /> <?php echo $mf1?>
			<?php if($mf1) { ?>
			<input type="checkbox" name="del_m1" value="1" />삭제
			<? } ?>
			</div>
			<div class="m_file2">
			<input type="file" name="m_file2" class="m_file" value=<?php echo $mf2?>"" /> <?php echo $mf2?>
			<?php if($mf2) { ?>
			<input type="checkbox" name="del_m2" value="1" />삭제
			<? } ?>
			</div>
		</td>
		</tr>
		<?php
		if($w != "u") {
		?>
			<script>
			var mf1 = $(".m_file1").detach();
			var mf2 = $(".m_file2").detach();
			$(".m_plus").click(function() {
				var mf_l = $(".m_file").length;
				if(mf_l == "1") {
					$(".mf_d1").html(mf1);
				} else if (mf_l == "2") {
					$(".mf_d2").html(mf2);
				} else if (mf_l == "3") {
					alert("더이상추가못함");
				}
			});
			$(".m_minu").click(function() {
				var mm_l = $(".m_file").length;
				if(mm_l == "1") {
					alert("더이상삭제못함");
				} else if (mm_l == "2") {
					$(".m_file1").detach();
				} else if (mm_l == "3") {
					$(".m_file2").detach();
				}

			});
			</script>
		<? } ?>
		<style>
		.i_plus {cursor:pointer}
		.i_minu {cursor:pointer}
		</style>
		<tr>
		<th>
			이미지파일첨부 <?php echo help2("그림형식으로 첨부한 파일입니다");?><br />
			<?php if($w != "u") { ?>
				<span class="i_plus"><img src="./img_btn/plus_btn.gif" /></span>
				<span class="i_minu"><img src="./img_btn/minu_btn.gif" /></span>
			<? } ?>
		</th>
		<td colspan="3">
			<?php
			$i0 = $write['i_file0'];
			$i1 = $write['i_file1'];
			$i2 = $write['i_file2'];

			$if0 = str_replace("./file/manage/", "", $i0);
			$if1 = str_replace("./file/manage/", "", $i1);
			$if2 = str_replace("./file/manage/", "", $i2);
			?>
			<div class="i_file0">
			<input type="file" name="i_file0" class="i_file" value="<?php echo $if0?>" /> <?php echo $if0?>
			<?php if($if0) { ?>
			<input type="checkbox" name="del_i0" value="1" />삭제
			<? } ?>
			</div>
			<div class="if_d1"></div><div class="if_d2"></div>
			<div class="i_file1">
			<input type="file" name="i_file1" class="i_file" value="<?php echo $if1?>" /> <?php echo $if1?>
			<?php if($if1) { ?>
			<input type="checkbox" name="del_i1" value="1" />삭제
			<? } ?>
			</div>
			<div class="i_file2">
			<input type="file" name="i_file2" class="i_file" value="<?php echo $if2?>" /> <?php echo $if2?>
			<?php if($if2) { ?>
			<input type="checkbox" name="del_i2" value="1" />삭제
			<? } ?>
			</div>
		</td>
		</tr>
		<?php
		if($w != "u") { ?>
			<script>
			var if1 = $(".i_file1").detach();
			var if2 = $(".i_file2").detach();
			$(".i_plus").click(function() {
				var if_l = $(".i_file").length;
				if(if_l == "1") {
					$(".if_d1").html(if1);
				} else if (if_l == "2") {
					$(".if_d2").html(if2);
				} else if (if_l == "3") {
					alert("더이상추가못함");
				}
			});
			$(".i_minu").click(function() {
				var im_l = $(".i_file").length;
				if(im_l == "1") {
					alert("더이상삭제못함");
				} else if (im_l == "2") {
					$(".if_d1").detach();
				} else if (im_l == "3") {
					$(".if_d2").detach();
				}

			});
			</script>
		<? } ?>
		<tr>
		<th>기타내용 <?php echo help2("기타내용을 입력합니다.");?></th>
		<td colspan="3" class="td_last">
			<textarea name="a_content" class="input_txt" rows="5" cols="90"><?php echo $write['a_content']?></textarea>
		</td>
		</tr>
		</table>
		<div class="input_btn">
			<input type="image" src="./img_btn/save_btn.gif" />
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<img src="./img_btn/list_btn.gif" class="list_btn" style="cursor:pointer" />
		</div>
	</form>
</div>

<script>
$(document).ready(function() {
	$(".map_area").hide();
	map_show = 0;
	$(".day_insert").hide();
});
function getDt(s) {
	return s.getFullYear()+ "-" + ("00" + (s.getMonth() + 1)).slice(-2) + "-" +("00" + s.getDate()).slice(-2); //날짜모양 2013-09-16
}


$(".a_years").click(function() {
	var f_day = $(".a_firstday").val();
	if(f_day != "") {
		var years = $(this).val();
		var term = "";
		if(years == "1") {
			term = 364;
		} else if (years == "2") {
			term = 729;
		} else if (years == "3") {
			term = 1094;
		} else if (years == "4") {
			term = 1459;
		}
		var str = $(".a_firstday").val().split("-")[1] + "/" + $(".a_firstday").val().split("-")[2] + "/" + $(".a_firstday").val().split("-")[0],
			firstday = new Date(str),
			endday = new Date(firstday.setDate(firstday.getDate() + term)),
			notiday = new Date(firstday.setDate(firstday.getDate() - 100));
		$(".endday").val(getDt(endday));
		$(".notiday").val(getDt(notiday));
	}
});


$(".list_btn").click(function() {
	location.href = "./manage.php?bo_table=manage";
});
</script>
<?
include_once ("../admin.tail.php");
?>